package com.whale.util;

import android.content.Context;
import android.widget.Toast;

import com.whale.entity.Comment;

public class ToastHelper {

	public static boolean ShowAddCommentResult(Context context, Comment c) {
		if (c != null) {
			Toast.makeText(context, "发送成功", Toast.LENGTH_SHORT).show();
			return true;
		} else {
			Toast.makeText(context, "网络连接不上，发送失败", Toast.LENGTH_SHORT).show();
			return false;
		}
	}

	public static void ShowSendFailure(Context context) {
		Toast.makeText(context, "网络连接不上，发送失败", Toast.LENGTH_SHORT).show();
	}

	public static void ShowDelCommentResult(Context context, int delNum) {
		if (delNum >= 0) {
			Toast.makeText(context, "删除评论成功，" + delNum + "条被删除",
					Toast.LENGTH_SHORT).show();
		} else {
			Toast.makeText(context, "删除评论失败", Toast.LENGTH_SHORT).show();
		}
	}

	public static void ShowDelStreamResult(Context context, int delNum) {
		if (delNum >= 0) {
			Toast.makeText(context, "删除Stream成功，" + delNum + "条被删除",
					Toast.LENGTH_SHORT).show();
		} else {
			Toast.makeText(context, "删除Stream失败", Toast.LENGTH_SHORT).show();
		}
	}

	/**
	 * @param retUrl
	 */
	public static void showSavePicResult(Context context, String retUrl) {
		if (retUrl != null) {
			Toast.makeText(context, "图片保存成功，保存在：" + retUrl, Toast.LENGTH_SHORT)
					.show();
		} else {
			Toast.makeText(context, "图片保存失败", Toast.LENGTH_SHORT).show();
		}
	}

	/**
	 * @param context
	 */
	public static void showNetworkErr(Context context) {
		Toast.makeText(context, "网络错误", Toast.LENGTH_SHORT).show();
	}

	/**
	 * @param loginActivity
	 * @param hasError
	 */
	public static void showLoginResult(Context context, boolean hasError) {
		if (hasError) {
			Toast.makeText(context, "用户名或密码错误", Toast.LENGTH_SHORT).show();
		} else {
			// Toast.makeText(context,
			// "登录成功", Toast.LENGTH_SHORT).show();
		}
	}

	/**
	 * @param context
	 * @param string
	 */
	public static void showFieldEmptyErr(Context context, String fieldName) {
		Toast.makeText(context, fieldName + "为空", Toast.LENGTH_SHORT).show();
	}

	/**
	 * @param context
	 */
	public static void showPicViewFailue(Context context) {
		Toast.makeText(context, "网络错误，获取图片失败", Toast.LENGTH_SHORT).show();
	}

	/**
	 * @param context
	 */
	public static void showLogout(Context context) {
		Toast.makeText(context, "注销登出，请重新登录", Toast.LENGTH_SHORT).show();
	}

}
